


            var watchWindowWidth = null;   
            var chasingMouse = null; 
            indexHeaderSwiper = new Swiper('.swiper-container',{
                loop:true,
                autoplay: {
                    disableOnInteraction: false,
                },
            })
            
            
            
          $(document).ready(function(){
                $('.headSwiper .flipBtn').click(function(){
                    if($(this)[0].className.indexOf('prev') >= 0){
                        indexHeaderSwiper.slidePrev();
                    }else{
                        indexHeaderSwiper.slideNext();
                    }
                })
                indexHeaderSwiper.autoplay.stop();
                    $('main .case .contn .sideNav li .fNav').mouseenter(function(){
                    $('main .case .contn .sideNav li .fNav').removeClass('msEnter');
                    $('main .case .contn .sideNav .sonMenu').css('height','0px');
                    if($(this).next()[0]){
                        $(this).addClass('msEnter');
                        $(this).next()[0].style.height = $(this).next()[0].children[0].offsetHeight + 'px';
                    }
                })
                var max = 0;
                var length = 0;
                for(var e = 0;e < $('main .case .contn .examplePalace .box').length;e++){
                    $('main .case .contn .sideNav li .fNav')[e].ind = $('main .case .contn .examplePalace .box')[e].ind = e;
                    if($('main .case .contn .examplePalace .box .item')[e].children.length > length){
                        length = $('main .case .contn .examplePalace .box .item')[e].children.length;
                        max = e;
                    }
                    if(e > 0){
                        $('main .case .contn .examplePalace .box:eq(' + e + ')').addClass('enter');
                    }
                }
                $('main .case .contn .examplePalace .box:eq(' + max + ')').addClass('base');
                
                $('main .case .contn .sideNav li .fNav').click(function(){
                    
                    var index = $(this)[0].ind;
                    if($('main .case .contn .examplePalace .box.current')[0].ind == index){
                        return false;
                    }
                    $('main .case .contn .examplePalace .box.current').removeClass('enter');
                    $('main .case .contn .examplePalace .box.current').addClass('leave');
                    $('main .case .contn .examplePalace .box.current').removeClass('current');
                    console.log(index);
                    setTimeout(function(){
                        console.log(index);
                        $('main .case .contn .examplePalace .box.leave').addClass('enter');
                        $('main .case .contn .examplePalace .box.leave').removeClass('leave');
                        $('main .case .contn .examplePalace .box:eq(+' + index + ')').addClass('current');
                        $('main .case .contn .examplePalace')[0].style.height = $('main .case .contn .examplePalace .current')[0].offsetHeight + 'px';
                        $('main .case .contn .examplePalace .box.current').removeClass('enter');
                    },400);
                })
                chasingMouse = setInterval(function(){
                    for(var n = 0;n < $('.needHover').length;n++){
                        var ele_h = $('.needHover')[n].offsetHeight;
                        var ele_w = $('.needHover')[n].offsetWidth;
                        var targetTop = mouseY - $('.needHover')[n].getBoundingClientRect().top;
                        var targetLeft = mouseX - $('.needHover')[n].getBoundingClientRect().left;
                        
                        if((targetLeft < 0 || targetLeft > ele_w) || (targetTop < 0 || targetTop > ele_h)){
                            if($('.needHover')[n].className.indexOf('hoverFather') >= 0){
                                var son_h = $('.needHover:eq(' + n + ') .hoverSon')[0].offsetHeight;
                                var son_w = $('.needHover:eq(' + n + ') .hoverSon')[0].offsetWidth;
                                var sonTop = mouseY - $('.needHover:eq(' + n + ') .hoverSon')[0].getBoundingClientRect().top;
                                var sonLeft = mouseX - $('.needHover:eq(' + n + ') .hoverSon')[0].getBoundingClientRect().left;
                                if((sonLeft < 0 || sonLeft > son_w) || (sonTop < 0 || sonTop > son_h)){
                                    if($('.needHover')[n].className.indexOf('mouseOn') < 0) continue;
                                    $('.needHover:eq(' + n +')').removeClass('mouseOn');
                                }else{
                                    if($('.needHover')[n].className.indexOf('mouseOn') >= 0) continue;
                                    $('.needHover:eq(' + n +')').addClass('mouseOn');
                                }
                            }else{
                                if($('.needHover')[n].className.indexOf('mouseOn') < 0) continue;
                                $('.needHover:eq(' + n +')').removeClass('mouseOn');
                            }
                        }else{//if((targetLeft > 0 && targetLeft < ele_w) && (targetTop > 0 && targetTop < ele_h))
                            if($('.needHover')[n].className.indexOf('mouseOn') >= 0) continue;
                            $('.needHover:eq(' + n +')').addClass('mouseOn');
                        }
                    }
                    
                },10);
                for(var n = 0;n < $('main .news .filter p').length;n++){
                    $('main .news .filter p')[n].ind = n;
                }
                $('main .news .filter p').click(function(){
                    var index = $(this)[0].ind;
                    $('main .news .filter p').removeClass('current');
                    $('main .news .newsBox .current').removeClass('current');
                    $(this).addClass('current');
                    $('main .news .newsBox ul:eq(' + index + ')').addClass('current');
                })
                if(consultWidth <= 1024){
                    $('main .case .contn .examplePalace')[0].style.height = $('main .case .contn .examplePalace .current')[0].offsetHeight + 'px';
                }
                $('main .about .content>.flipBtn').click(function(){
                    var currentH = $('main .about .content .txt .txtBox')[0].offsetHeight;
                    var actualH = 0;
                    for(var p = 0;p < $('main .about .content .txt .txtBox p').length;p++){
                        actualH += $('main .about .content .txt .txtBox p')[p].offsetHeight;
                        p > 0 && (actualH += 5);
                    }
                    if(currentH != actualH){
                        $(this).addClass('rotate');
                        $('main .about .content .txt .txtBox')[0].style.height = actualH + 'px';
                    }else{
                        $(this).removeClass('rotate');
                        var lineH = parseInt($('main .about .content .txt .txtBox p').css('line-height'));
                        var height = (lineH * 4);
                        height += 5;
                        $('main .about .content .txt .txtBox')[0].style.height = height + 'px';
                    }
                })
                watchWindowWidth = setInterval(function(){
                    if(window.innerWidth != consultWidth){
                        consultWidth = window.innerWidth;
                        if(consultWidth <= 1024){
                            $('main .case .contn .examplePalace')[0].style.height = $('main .case .contn .examplePalace .current')[0].offsetHeight + 'px';
                        }else{
                            $('main .case .contn .examplePalace')[0].style.height = '';
                        }
                    }
                    if($('main .about .content .txt .txtBox')[0].className.indexOf('show') < 0){
                        if(window.innerWidth < 768){
                            var currentH = $('main .about .content .txt .txtBox')[0].offsetHeight;
                            var actualH = 0;
                            for(var p = 0;p < $('main .about .content .txt .txtBox p').length;p++){
                                actualH += $('main .about .content .txt .txtBox p')[p].offsetHeight;
                                p > 0 && (actualH += 5);
                            }
                            if(!$('main .about .content .txt .txtBox')[0].style.height){
                                var lineH = parseInt($('main .about .content .txt .txtBox p').css('line-height'));
                                var height = (lineH * 4);
                                height += 5;
                                $('main .about .content .txt .txtBox')[0].style.height = height + 'px';
                            }else if($('main .about .content>.flipBtn')[0].className.indexOf('rotate') >= 0 && currentH != actualH){
                                $('main .about .content .txt .txtBox')[0].style.height = actualH + 'px';
                            }
                            
                        }else if(window.innerWidth >= 768 && $('main .about .content .txt .txtBox')[0].style.height){
                            $('main .about .content .txt .txtBox')[0].style.height = '';
                            $('main .about .content>.flipBtn').removeClass('rotate');
                        }
                    }
                    
                },10)
          })